package com.inmobi.re.controller;

import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import com.inmobi.re.container.IMWebView;
import com.inmobi.re.controller.util.NavigationStringEnum;
import com.inmobi.re.controller.util.TransitionStringEnum;
import java.lang.reflect.Field;
import java.util.Locale;
import org.json.JSONException;
import org.json.JSONObject;

public abstract class JSController
{
  public static final String EXIT = "exit";
  public static final String FULL_SCREEN = "fullscreen";
  public static final String STYLE_NORMAL = "normal";
  protected ExpandProperties expProps;
  protected IMWebView imWebView;
  protected Context mContext;
  protected ExpandProperties temporaryexpProps;

  public JSController(IMWebView paramIMWebView, Context paramContext)
  {
    this.imWebView = paramIMWebView;
    this.mContext = paramContext;
    this.expProps = new ExpandProperties();
    this.temporaryexpProps = new ExpandProperties();
  }

  protected static Object getFromJSON(JSONObject paramJSONObject, Class<?> paramClass)
    throws IllegalAccessException, InstantiationException, NumberFormatException, NullPointerException
  {
    Field[] arrayOfField = paramClass.getDeclaredFields();
    Object localObject = paramClass.newInstance();
    int i = 0;
    while (true)
    {
      Field localField;
      String str1;
      String str2;
      if (i < arrayOfField.length)
      {
        localField = arrayOfField[i];
        str1 = localField.getName().replace('_', '-');
        str2 = localField.getType().toString();
      }
      try
      {
        String str3;
        if (str2.equals("int"))
          str3 = paramJSONObject.getString(str1).toLowerCase(Locale.ENGLISH);
        try
        {
          boolean bool = str3.startsWith("#");
          if (bool)
            j = -1;
        }
        catch (NumberFormatException localNumberFormatException1)
        {
          try
          {
            int j;
            if (str3.startsWith("#0x"))
            {
              int n = Integer.decode(str3.substring(1)).intValue();
              j = n;
            }
            while (true)
            {
              label119: localField.set(localObject, Integer.valueOf(j));
              while (true)
              {
                label130: i++;
                break;
                int m = Integer.parseInt(str3.substring(1), 16);
                j = m;
                break label119;
                int k = Integer.parseInt(str3);
                j = k;
                break label119;
                if (str2.equals("class java.lang.String"))
                  localField.set(localObject, paramJSONObject.getString(str1));
                else if (str2.equals("boolean"))
                  localField.set(localObject, Boolean.valueOf(paramJSONObject.getBoolean(str1)));
                else if (str2.equals("float"))
                  localField.set(localObject, Float.valueOf(Float.parseFloat(paramJSONObject.getString(str1))));
                else if (str2.equals("class com.mraid.NavigationStringEnum"))
                  localField.set(localObject, NavigationStringEnum.fromString(paramJSONObject.getString(str1)));
                else if (str2.equals("class com.mraid.TransitionStringEnum"))
                  localField.set(localObject, TransitionStringEnum.fromString(paramJSONObject.getString(str1)));
              }
              return localObject;
              localNumberFormatException1 = localNumberFormatException1;
              j = 0;
            }
          }
          catch (NumberFormatException localNumberFormatException2)
          {
            break label119;
          }
        }
      }
      catch (JSONException localJSONException)
      {
        break label130;
      }
    }
  }

  public abstract void stopAllListeners();

  public static class Dimensions extends JSController.ReflectedParcelable
  {
    public static final Parcelable.Creator<Dimensions> CREATOR = new b();
    public int height;
    public int width;
    public int x;
    public int y;

    public Dimensions()
    {
      this.x = -1;
      this.y = -1;
      this.width = -1;
      this.height = -1;
    }

    protected Dimensions(Parcel paramParcel)
    {
      super();
    }

    public String toString()
    {
      return "x: " + this.x + ", y: " + this.y + ", width: " + this.width + ", height: " + this.height;
    }
  }

  public static class ExpandProperties extends JSController.ReflectedParcelable
  {
    public static final Parcelable.Creator<ExpandProperties> CREATOR = new e();
    public int actualHeightRequested;
    public int actualWidthRequested;
    public int bottomStuff;
    public int currentX;
    public int currentY;
    public int height;
    public boolean isModal;
    public boolean lockOrientation;
    public String orientation;
    public int portraitHeightRequested;
    public int portraitWidthRequested;
    public String rotationAtExpand;
    public int topStuff;
    public boolean useCustomClose;
    public int width;
    public int x;
    public int y;
    public boolean zeroWidthHeight;

    public ExpandProperties()
    {
      reinitializeExpandProperties();
    }

    protected ExpandProperties(Parcel paramParcel)
    {
      super();
    }

    public void reinitializeExpandProperties()
    {
      this.width = 0;
      this.height = 0;
      this.x = -1;
      this.y = -1;
      this.useCustomClose = false;
      this.isModal = true;
      this.lockOrientation = false;
      this.orientation = "";
      this.actualWidthRequested = 0;
      this.actualHeightRequested = 0;
      this.topStuff = 0;
      this.bottomStuff = 0;
      this.portraitWidthRequested = 0;
      this.portraitHeightRequested = 0;
      this.zeroWidthHeight = false;
      this.rotationAtExpand = "";
      this.currentX = 0;
      this.currentY = 0;
    }
  }

  public static class OrientationProperties extends JSController.ReflectedParcelable
  {
    public static final Parcelable.Creator<OrientationProperties> CREATOR = new a();
    public boolean allowOrientationChange;
    public String forceOrientation;

    public OrientationProperties()
    {
      initializeOrientationProperties();
    }

    protected OrientationProperties(Parcel paramParcel)
    {
      super();
    }

    public void initializeOrientationProperties()
    {
      this.allowOrientationChange = false;
      this.forceOrientation = "";
    }
  }

  public static class PlayerProperties extends JSController.ReflectedParcelable
  {
    public static final Parcelable.Creator<PlayerProperties> CREATOR = new g();
    public boolean audioMuted;
    public boolean autoPlay;
    public boolean doLoop;
    public String id;
    public boolean showControl;
    public String startStyle;
    public String stopStyle;

    public PlayerProperties()
    {
      this.showControl = true;
      this.autoPlay = true;
      this.audioMuted = false;
      this.doLoop = false;
      this.stopStyle = "normal";
      this.startStyle = "normal";
      this.id = "";
    }

    public PlayerProperties(Parcel paramParcel)
    {
      super();
    }

    public boolean doLoop()
    {
      return this.doLoop;
    }

    public boolean doMute()
    {
      return this.audioMuted;
    }

    public boolean exitOnComplete()
    {
      return this.stopStyle.equalsIgnoreCase("exit");
    }

    public boolean isAutoPlay()
    {
      return this.autoPlay == true;
    }

    public boolean isFullScreen()
    {
      return this.startStyle.equalsIgnoreCase("fullscreen");
    }

    public void setFullScreen()
    {
      this.startStyle = "fullscreen";
    }

    public void setProperties(boolean paramBoolean1, boolean paramBoolean2, boolean paramBoolean3, boolean paramBoolean4, String paramString1, String paramString2, String paramString3)
    {
      this.autoPlay = paramBoolean2;
      this.showControl = paramBoolean3;
      this.doLoop = paramBoolean4;
      this.audioMuted = paramBoolean1;
      this.startStyle = paramString1;
      this.stopStyle = paramString2;
      this.id = paramString3;
    }

    public void setStopStyle(String paramString)
    {
      this.stopStyle = paramString;
    }

    public boolean showControl()
    {
      return this.showControl;
    }
  }

  public static class Properties extends JSController.ReflectedParcelable
  {
    public static final Parcelable.Creator<Properties> CREATOR = new d();
    public int backgroundColor;
    public float backgroundOpacity;
    public boolean useBackground;

    public Properties()
    {
      this.useBackground = false;
      this.backgroundColor = 0;
      this.backgroundOpacity = 0.0F;
    }

    protected Properties(Parcel paramParcel)
    {
      super();
    }
  }

  public static class ReflectedParcelable
    implements Parcelable
  {
    public ReflectedParcelable()
    {
    }

    protected ReflectedParcelable(Parcel paramParcel)
    {
      Field[] arrayOfField = getClass().getDeclaredFields();
      for (int i = 0; ; i++)
        try
        {
          if (i < arrayOfField.length)
          {
            localField = arrayOfField[i];
            Class localClass = localField.getType();
            if (!localClass.isEnum())
              break label107;
            String str = localClass.toString();
            if (str.equals("class com.mraid.NavigationStringEnum"))
              localField.set(this, NavigationStringEnum.fromString(paramParcel.readString()));
            else if (str.equals("class com.mraid.TransitionStringEnum"))
              localField.set(this, TransitionStringEnum.fromString(paramParcel.readString()));
          }
        }
        catch (IllegalArgumentException localIllegalArgumentException)
        {
          Field localField;
          localIllegalArgumentException.printStackTrace();
          return;
          if (!(localField.get(this) instanceof Parcelable.Creator))
            localField.set(this, paramParcel.readValue(null));
        }
        catch (IllegalAccessException localIllegalAccessException)
        {
          label107: localIllegalAccessException.printStackTrace();
          return;
        }
    }

    public int describeContents()
    {
      return 0;
    }

    public void writeToParcel(Parcel paramParcel, int paramInt)
    {
      Field[] arrayOfField = getClass().getDeclaredFields();
      for (int i = 0; ; i++)
        try
        {
          if (i < arrayOfField.length)
          {
            localField = arrayOfField[i];
            Class localClass = localField.getType();
            if (!localClass.isEnum())
              break label112;
            String str = localClass.toString();
            if (str.equals("class com.mraid.NavigationStringEnum"))
              paramParcel.writeString(((NavigationStringEnum)localField.get(this)).getText());
            else if (str.equals("class com.mraid.TransitionStringEnum"))
              paramParcel.writeString(((TransitionStringEnum)localField.get(this)).getText());
          }
        }
        catch (IllegalArgumentException localIllegalArgumentException)
        {
          Field localField;
          localIllegalArgumentException.printStackTrace();
          return;
          Object localObject = localField.get(this);
          if (!(localObject instanceof Parcelable.Creator))
            paramParcel.writeValue(localObject);
        }
        catch (IllegalAccessException localIllegalAccessException)
        {
          label112: localIllegalAccessException.printStackTrace();
          return;
        }
    }
  }

  public static class ResizeProperties extends JSController.ReflectedParcelable
  {
    public static final Parcelable.Creator<ResizeProperties> CREATOR = new f();
    public boolean allowOffscreen;
    public String customClosePosition;
    public int height;
    public int offsetX;
    public int offsetY;
    public int width;

    public ResizeProperties()
    {
      initializeResizeProperties();
    }

    protected ResizeProperties(Parcel paramParcel)
    {
      super();
    }

    public void initializeResizeProperties()
    {
      this.offsetY = 0;
      this.offsetX = 0;
      this.height = 0;
      this.width = 0;
      this.allowOffscreen = false;
      this.customClosePosition = "top-right";
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.inmobi.re.controller.JSController
 * JD-Core Version:    0.6.2
 */